package com.ibm.ems.dao;


import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import com.ibm.ems.dto.Speaker;

public class SpeakerDAO {
	
	private Connection con;
	

	public SpeakerDAO(Connection conn) {
		this.con = conn;
	}
	public Speaker getSpeakerDetails(Speaker e) throws SQLException{
		PreparedStatement pstmt = null;
		
		ResultSet rs = null;
		try {
			pstmt = con.prepareStatement("select Event_Id,Event_name from Events where Speaker_Name IS NULL");
			//pstmt.setInt(1, e.getEventId());
		
			rs = pstmt.executeQuery();
		
			while (rs.next()) {
				e.setEventName(rs.getString("EventName"));
				
				
			}
		} catch (SQLException ex) {
			throw ex;
		} finally {
			try {
				if (rs != null)
					rs.close();
				if (pstmt != null)
					pstmt.close();
			} catch (Exception ex1){
				
			}
		}
		
		con.close();
//		Speaker speaker = new Speaker();
//		speaker.setEventId(0);
//		return speaker;
		return e;
	}
	
}
